/***********************************************************************
 * Module:  ElementPainter.java
 * Author:  Nikola
 * Purpose: Defines the Class ElementPainter
 ***********************************************************************/

package genedit.view.graph;

import genedit.model.graph.GraphElement;

import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;

public abstract class ElementPainter {
	protected Shape shape;
	protected AffineTransform transform;
	
	protected GraphElement element;

	/** @param element */
	public ElementPainter(GraphElement element) {
		this.element = element;
		transform=new AffineTransform();
	}

	/** @param g */
	public void paint(Graphics2D g) {
		g.draw(shape);
	}

	/** @param p */
	public boolean isElementAt(Point2D p) {
		return shape.contains(p.getX(), p.getY());
	}

	/** @param r */
	public boolean isElementIn(Rectangle2D r) {
		// TODO: implement
		return false;
	}

	public Shape getShape() {
		return shape;
	}

	/** @param newShape */
	public void setShape(Shape newShape) {
		shape = newShape;
	}

	public void refreshAffine(){
		
	}
	
	public void resizeShape(){
		
	}

	/** @pdGenerated default parent getter */
	public GraphElement getElement() {
		return element;
	}

	/**
	 * @pdGenerated default parent setter
	 * @param newGraphElement
	 */
	public void setElement(GraphElement newGraphElement) {
		this.element = newGraphElement;
	}

	public AffineTransform getTransform() {
		return transform;
	}

	public void setTransform(AffineTransform transform) {
		this.transform = transform;
	}

}